<template>
  <div class="app-container">
    <!-- 直播记录页面 -->
    <reservation-list-container
      :searchItems="searchItems"
      :actionButtons="actionButtons"
      :tableData="tableData"
      :columns="columns"
      :loading="loading"
      :total="1000"
      :showResetButton="false"
      @search="handleSearch"
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      @sort-change="handleSortChange"
    ></reservation-list-container>
  </div>
</template>

<script lang="ts" setup>
import { ref } from "vue";
import ReservationListContainer from "@/components/PageTable/ReservationList.vue";

// 搜索项配置
const searchItems = [
  {
    label: " 歌单标题",
    prop: "name",
    component: "el-input",
    props: {
      placeholder: "请输入名称",
    },
  },
  {
    label: "创建时间",
    prop: "date",
    component: "el-date-picker",
    props: {
      placeholder: "请输入名称",
    },
  },
  {
    label: "状态",
    prop: "status",
    component: "el-select",
    props: {
      options: [
        { label: "全部", value: null },
        { label: "启用", value: 1 },
        { label: "禁用", value: 0 },
      ],
    },
    defaultValue: null,
  },
];

// 操作按钮配置
const actionButtons = [
  {
    text: "新增歌单",
    handler: () => {
      addRef.value.show();
    },
    type: "primary" as "primary",
    icon: undefined,
    loading: false,
  },
];

// 表格列配置
const columns = [
  {
    prop: "type",
    label: "房间类型",
  },
  {
    prop: "liveDate",
    label: "开播日期",
  },
  {
    prop: "startTime",
    label: "直播开始时间",
  },
  {
    prop: "endTime",
    label: "直播结束时间",
  },
  {
    prop: "liveRange",
    label: "直播时长",
  },
  {
    prop: "newFollow",
    label: "新增关注",
  },
  {
    prop: "onlinePeak",
    label: "在线人数峰值",
  },
  {
    prop: "giftNumber",
    label: "送礼人数",
  },
  {
    prop: "earnings",
    label: "收益（蓝欲米）",
  },
];

// 表格数据
const tableData = ref([
  {
    type: "房间类型",
    liveDate: "2025-02-18",
    startTime: "2025-02-18 15:00:00",
    endTime: "2025-02-18 15:00:00",
    liveRange: "11:11:11",
    newFollow: "11111",
    onlinePeak: "111111",
    giftNumber: "111",
    earnings: "11111",
  },
]);

const loading = ref(false);
const addRef = ref();

// 搜索方法
const handleSearch = (searchData: any) => {
  console.log("搜索操作", searchData);
};

// 分页大小变化方法
const handleSizeChange = (size: any) => {
  console.log("分页大小变化", size);
};

// 当前页变化方法
const handleCurrentChange = (page: any) => {
  console.log("当前页变化", page);
};

// 排序变化方法
const handleSortChange = (sortInfo: any) => {
  console.log("排序变化", sortInfo);
};
</script>
<style lang="scss" scoped></style>
